Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Accessing data based on grid selected row

12 views
Skip to first unread message

Ilya Tumanov [MS]

unread,
Nov 13, 2006, 3:52:05 PM11/13/06
to
I've noticed VB developers tend to (over/miss) use message boxes a lot
without realizing they drive users completely insane.

You can not copy data from them and you have to push the button every time
it pops up - absolutely terrible.

In this case it's probably way better to add a "Description" tab with big
message box for description and bind it to the same data view so it would be
updated automatically.

Anyway, if you'd like to carry out your original message box idea, here's
how to access selected row:

dataView(dataGrid.CurrentRowIndex)("ColumNameOrIndex")


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Rob Morriss" <RobMo...@discussions.microsoft.com> wrote in message
news:25765FBB-1460-4376...@microsoft.com...
>I have a grid bound to a dataview. I want the user to be able to select a
> cell, then in the menu select 'description' which would show a messagebox
> containing a description of the item in that row. The description is in a
> hidden column on the selected row. I can't seem to retrieve the dataview
> information based on the selected row in the datagrid. How can I do this?


Rob Morriss

unread,
Nov 13, 2006, 5:21:01 PM11/13/06
to
In this case the description will rarely be needed. The screen space taken
by the tabs won't be worth it.

Anyway, I had already tried what I think is the C# equivalent to what you
suggested:
dataRow = dataView.Table.Rows[dataGrid.CurrentRowIndex]

But my problem was that dataRow was assigned the row indexed by the DataSet,
once I applied a filter and sort to dataView, the results returned were
incorrect.

Anyway, I 'solved' the problem by adding a 0-width description column to the
grid.

Thanks,

Rob

Ilya Tumanov [MS]

unread,
Nov 13, 2006, 6:04:27 PM11/13/06
to
No, that is not the equivalent. Your code would access rows in DataTable
disregarding DataView.

And you're correct; row index in DataTable can be different from row index
in DataView due to sorting and filtering.

Here's how to get correct DataRow:

dataRow = dataView[dataGrid.CurrentRowIndex].Row;

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"Rob Morriss" <RobMo...@discussions.microsoft.com> wrote in message

news:C6E00B5F-A95C-40DC...@microsoft.com...

Rob Morriss

unread,
Nov 14, 2006, 10:27:01 AM11/14/06
to
Ah, perfect. Thanks again!
0 new messages